package com.wwt.service.impl;

import java.io.UnsupportedEncodingException;

import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.wwt.entity.Admin;
import com.wwt.mapper.AdminMapper;
import com.wwt.service.AdminService;

@Service("adminService")
@Transactional
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;

    public AdminMapper getAdminMapper() {
		return adminMapper;
	}

	public void setAdminMapper(AdminMapper adminMapper) {
		this.adminMapper = adminMapper;
	}

	@Override
	public Admin login(Admin admin) throws UnsupportedEncodingException {
        String a=admin.getAdminPwd();
        String pwd= DigestUtils.md5Hex(a.getBytes("utf-8"));
        admin.setAdminPwd(pwd);
        return adminMapper.login(admin);
    }
}
